package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.math.BigDecimal;
import java.util.Date;
import java.io.Serializable;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 
 * </p>
 * @author hua
 * @since 2025-01-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
//@Accessors(chain = true)
@TableName("t_platform_product")
@NoArgsConstructor
public class PlatformProductDo extends Model<PlatformProductDo> {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("parent_sku")
    private String parentSku;

    @TableField("platform_sku")
    private String platformSku;
    @TableField("stock_percent")
    private Double stockPercent;


    @TableField("store_id")
    private Long storeId;

    @TableField("product_presale")
    private Integer productPresale;

    @TableField("image_url")
    private String imageUrl;

    @TableField("asin")
    private String asin;

    @TableField("fn_sku")
    private String fnSku;

    @TableField("product_type")
    private String productType;

    @TableField("fulfillment_channel_code")
    private String fulfillmentChannelCode;

    @TableField("inventory_link")
    private Integer inventoryLink;

    @TableField("inventory_less")
    private Integer inventoryLess;


    @TableField("item_name")
    private String itemName;

    @TableField("plat_left_quantity")
    private Integer platLeftQuantity;

    @TableField("hide_item")
    private Integer hideItem;

    @TableField(value = "delete_flag", fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleteFlag;

    @TableField(value = "create_by",fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @TableField("delete_by")
    private Long deleteBy;

    @TableField("delete_time")
    private Date deleteTime;

    @TableField(value = "company_id", fill = FieldFill.INSERT)
    private Long companyId;

    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    private Long tenantId;

    @TableField("three_days_weight")
    private Double threeDaysWeight;

    @TableField("seven_days_weight")
    private Double sevenDaysWeight;

    @TableField("thirty_days_weight")
    private Double thirtyDaysWeight;

    @TableField("variant_id")
    private String variantId;

    @TableField("merchant_defined_sku_id")
    private String merchantDefinedSkuId;

    @TableField("matched")
    private Integer matched;

    @TableField("system_sku")
    private String systemSku;

    @TableField("horizontal_item_name")
    private String horizontalItemName;

    @TableField("vertical_item_name")
    private String verticalItemName;

    @TableField("option_name1")
    private String optionName1;

    @TableField("option_name2")
    private String optionName2;

    @TableField("option_name3")
    private String optionName3;

    @TableField("option_value1")
    private String optionValue1;
    @TableField("option_value2")
    private String optionValue2;

    @TableField("option_value3")
    private String optionValue3;

    @TableField("option_horizontal_seq")
    private String optionHorizontalSeq;

    @TableField("option_vertical_seq")
    private String optionVerticalSeq;

    @TableField("shipping_day_id")
    private String shippingDayId;

    @TableField("price")
    private BigDecimal price;

//    public Double getThreeDaysWeight() {
//        if (threeDaysWeight == null) {
//            return 0.5d;
//        }
//        return threeDaysWeight;
//    }
//
//    public Double getSevenDaysWeight() {
//        if (sevenDaysWeight == null) {
//            return 0.3d;
//        }
//        return sevenDaysWeight;
//    }
//
//    public Double getThirtyDaysWeight() {
//        if (thirtyDaysWeight == null) {
//            return 0.2d;
//        }
//        return thirtyDaysWeight;
//    }

    public PlatformProductDo(Long storeId, String parentSku, String platformSku, Double stockPercent, Integer inventoryLink, Integer platLeftQuantity, String systemSku, int matched, Long companyId, Long tenantId, Long userId) {
        this.storeId = storeId;
        this.parentSku = parentSku;
        this.platformSku = platformSku;
        this.stockPercent = stockPercent;
        this.inventoryLink = inventoryLink;
        this.platLeftQuantity = platLeftQuantity;
        this.systemSku = systemSku;
        this.matched = matched;
        this.companyId = companyId;
        this.tenantId = tenantId;
        this.createBy = userId;
    }


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
